import Cn.Sarkar.Entities.MMS.Independent.IApplication
import Cn.Sarkar.Entities.MMS.ToJsonEntities.JApplication
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.*
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.IDBTable
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.QueryBuilderExtensions.SelectQueryExpression.*
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.IDataContext
import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.SQLite.SQLiteDataContext
import Cn.Sarkar.EntityDream.Pipeline.Extension.installFeature
import Cn.Sarkar.MMS.LayerOne.registerMMSInterfaceInstances
import Cn.Sarkar.logger
import com.beust.klaxon.Klaxon
import com.google.gson.GsonBuilder
import org.joda.time.DateTime
import org.koin.Koin
import org.koin.KoinContext
import org.koin.dsl.module.applicationContext
import org.koin.standalone.KoinComponent
import org.koin.standalone.StandAloneContext.startKoin
import org.koin.standalone.inject
import java.io.File
import java.sql.DriverManager

/**
Company: Sarkar software technologys
WebSite: http://www.sarkar.cn
Author: yeganaaa
Date : 3/6/18
Time: 3:34 PM
 */

interface IPersonRepositry{
    fun getName(): String
}

class MyPersonRepository : IPersonRepositry{
    override fun getName(): String {
        return "yeganaaa"
    }
}

class PersonController(val repository: IPersonRepositry){
    fun execute(){
        println("Hello ${repository.getName()}.")
    }
}

class MyApplication : KoinComponent {
    val personController : PersonController by inject()
    init {
        personController.execute()
    }
}

fun main(args: Array<String>) {
    val personRepositoryModule = applicationContext {
        factory { MyPersonRepository() as IPersonRepositry }
        factory { PersonController(get()) }
    }

    startKoin(listOf(personRepositoryModule))

    MyApplication()
}